<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * SupportRequest filter form base class.
 *
 * @package    wifilez
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseSupportRequestFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'publisher_id'       => new sfWidgetFormFilterInput(),
      'account_id'         => new sfWidgetFormPropelChoice(array('model' => 'Account', 'add_empty' => true)),
      'product_id'         => new sfWidgetFormPropelChoice(array('model' => 'Product', 'add_empty' => true)),
      'customer_name'      => new sfWidgetFormFilterInput(),
      'email'              => new sfWidgetFormFilterInput(),
      'subject'            => new sfWidgetFormFilterInput(),
      'created'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'modified'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'status'             => new sfWidgetFormFilterInput(),
      'comment'            => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'publisher_id'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'account_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Account', 'column' => 'account_id')),
      'product_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Product', 'column' => 'product_id')),
      'customer_name'      => new sfValidatorPass(array('required' => false)),
      'email'              => new sfValidatorPass(array('required' => false)),
      'subject'            => new sfValidatorPass(array('required' => false)),
      'created'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'modified'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'status'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'comment'            => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('support_request_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'SupportRequest';
  }

  public function getFields()
  {
    return array(
      'support_request_id' => 'Number',
      'publisher_id'       => 'Number',
      'account_id'         => 'ForeignKey',
      'product_id'         => 'ForeignKey',
      'customer_name'      => 'Text',
      'email'              => 'Text',
      'subject'            => 'Text',
      'created'            => 'Date',
      'modified'           => 'Date',
      'status'             => 'Number',
      'comment'            => 'Text',
    );
  }
}
